import request from '@/config/axios'
import type { LeakageTempData } from './types'

export const getLeakageTempListApi = (params: any): Promise<IResponse> => {
    const queryParams = params.queryParams ? params.queryParams : {}
    if (params.queryParams) {
        delete params.queryParams
    }
    Object.assign(params, queryParams)
    return request.get({ url: '/leakage/tmp/page', params })
}

export const saveOrUpdateLeakageTempApi = (data: Partial<LeakageTempData>, isUpdate = false): Promise<IResponse> => {
    if (isUpdate) {
        return request.post({ url: '/leakage/tmp/edit', data })
    } else {
        return request.post({ url: '/leakage/tmp/save', data })
    }
}


export const delLeakageTempApi = (data: Partial<LeakageTempData>[]): Promise<IResponse> => {
    return request.post({ url: '/leakage/tmp/delete', data: { id: data[0].id } })
}

